/********************************************************************************
 *      Copyright:  (C) 2022 YanlinZhou<1222>
 *                  All rights reserved.
 *
 *       Filename:  getopt.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(04/09/2022)
 *         Author:  YanlinZhou <1222>
 *      ChangeLog:  1, Release initial version on "04/09/2022 08:38:44 AM"
 *                 
 ********************************************************************************/

#ifndef  _SOCKET_H_
#define  _SOCKET_H_

#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
#include <sys/socket.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>          
#include <arpa/inet.h>
#include <unistd.h>

typedef struct
{
    char *server_ip;
    int  server_port;
    int  connect_fd;
} socket_info_t;

/***************************Funtion declaration******************************
| * Function nam: print_client_usage
| * Funtion performance: to print the command line parameter parsing usage
| * Parameter: char *progname
| * Returned value: 1
| * Description: NULL
*****************************************************************************/
int print_client_usage(char *progname);


/***************************Funtion declaration******************************
| * Function nam: socket_client_init
| * Funtion performance: socket init and connect to specify server
| * Parameter: char * server_ip, char * server_port
| * Returned value:sokt->connect_fd
| * Description: NULL
*****************************************************************************/
int socket_client_init(socket_info_t *sokt);


/***************************Funtion declaration******************************
| * Function nam: send_table_first_roll
| * Funtion performance:
| * Parameter:
| * Returned value:
| * Description: NULL
*****************************************************************************/
int send_table_first_roll(socket_info_t *sokt, char *str);


/***************************Funtion declaration******************************
| * Function nam: send_sample_data
| * Funtion performance: send the client sample data to the connected server
| * Parameter: float *sample_data, int connect_fd
| * Returned value: the write funtion Returned valures--rv
| * Description: NULL
*****************************************************************************/
int send_sample_data(socket_info_t *sokt, char *sample_data);

#endif   /* ----- #ifndef _SOCKET_H_  ----- */


